package com.liujun.spring4.demo.aop.iocset.xmlset.functionLookup;


import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

/**
 * 进行工厂方法测试
 *
 * @author liujun
 * @version 1.0
 * @date 2018-08-16 17:33:00
 */
public class BeanFunctionLookup {

  private ApplicationContext context;

  @BeforeClass
  private void start() {
    context =
        new ClassPathXmlApplicationContext(
                "com/liujun/spring4/demo/aop/iocset/xmlset/functionLookup/beanFunctionLookup.xml");
  }

  @Test
  public void testlookUpMed() {
    MaigicBoss boss = (MaigicBoss) context.getBean("magicBoss");
    Car car = boss.getCar();
    Assert.assertNotNull(car);
  }


  @Test
  public void testRepLookupMed()
  {
    Boss boses = (Boss)context.getBean("bossObj");
    System.out.println(boses.getCar());
    Assert.assertNotNull(boses);
  }

}
